package cn.threewaters.qtyy.config.multids;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import com.baomidou.mybatisplus.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.spring.boot.starter.MybatisPlusProperties;

@Configuration
public class InitMybatisPlusProperties {

	public static final String MYBATIS_PLUS_PREFIX1 = "mybatis-plus1";

	public static final String MYBATIS_PLUS_PREFIX2 = "mybatis-plus2";

	@Bean(name = "mybatisPlusProperties1")
	@Primary
	@ConfigurationProperties(prefix = InitMybatisPlusProperties.MYBATIS_PLUS_PREFIX1)
	public MybatisPlusProperties mybatisPlusProperties1() {
		return new MybatisPlusProperties();
	}

	@Bean(name = "mybatisPlusProperties2")
	@ConfigurationProperties(prefix = InitMybatisPlusProperties.MYBATIS_PLUS_PREFIX2)
	public MybatisPlusProperties mybatisPlusProperties2() {
		return new MybatisPlusProperties();
	}

	@Bean
	public PaginationInterceptor paginationInterceptor() {
		PaginationInterceptor page = new PaginationInterceptor();
		return page;
	}
}
